<div class="call-me-form">

    <div class="buying-services__form">

        <h3 class="popup-title"><?php echo $_GET['title']; ?></h3>
        <!--        <div style="float: left;padding-top:33px;">
                    <img src="/uploads/images/qril.png" style="width: 90px;">
                </div>-->
        <?php
        $tip = isset($_GET['tip']) ? '&tip=' . $_GET['tip'] : '';
        $brend = isset($_GET['brand']) ? '&brand=' . $_GET['brand'] : '';
        $m = isset($_GET['m']) ? '&model=' . $_GET['m'] : '';
        $form = $this->beginWidget('CActiveForm', array(
            'id' => 'request-form-022',
            'action' => '/main/ajax/request?pageTitle=' . $_GET['pageTitle'] . '&pageUrl=' . $_GET['pageUrl'] . $tip . $brend . $m,
            'enableClientValidation' => true,
            'clientOptions' => array(
                'validateOnSubmit' => true,
            ),
        ));
        ?>
        <div style="display: none">            
            <?php echo $form->error($model, 'userName'); ?>
            <?php echo $form->error($model, 'userPhone'); ?>
        </div>
        <fieldset>
            <div class="type-text">
                <?php echo $form->textField($model, 'userName', array('placeholder' => 'Ваше имя')); ?>
            </div>
        </fieldset>
        <fieldset>
            <div class="type-text">
                <?php echo $form->textField($model, 'userPhone', array('placeholder' => 'Ваш телефон', 'class' => 'masked-phone', 'id' => 'test-022')); ?>
            </div>
        </fieldset>
        <fieldset>
            <p class="global-warning">
                <?php echo $_GET['desc']; ?>
            </p>
        </fieldset>
        <fieldset class="center">
            <div class="type-submit">
                <?php echo CHtml::submitButton('Отправить'); ?>			
            </div> 
        </fieldset>
        <?php $this->endWidget(); ?>
        <script type="text/javascript">
            /*&lt;![CDATA[*/
            jQuery("#test-022").mask("+7 (999) 999-99-99");

            jQuery('#request-form-022').yiiactiveform({'validateOnSubmit': true,
                'afterValidate':
                        function (form, data, hasError) {
                            if (!hasError) {
                                var cur = $('#curer').find('input[type="radio"]:checked');
                                var status = cur.attr('id') == 'status' ? 'status' : 'new client';
<?php echo $_GET['sc']; ?>
                                $.ajax({
                                    type: "POST",
                                    url: form[0].action,
                                    data: $(form).serialize(),
                                    success: function (ret) {
                                        $('.fancybox-close').trigger('click');
                                        var data = JSON.parse(ret);
                                        mobi03.showMessage(data.message.title, data.message.desc);
                                    }
                                });
                            }
                        }
                , 'attributes': [{'id': 'test-022', 'inputID': 'test-022', 'errorID': 'RequestForm_userPhone_em_', 'model': 'RequestForm', 'name': 'userPhone', 'enableAjaxValidation': false, 'clientValidation': function (value, messages, attribute) {

                            if (jQuery.trim(value) == '') {
                                messages.push("\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u0435 \u00abUser Phone\u00bb.");
                            }

                        }}], 'errorCss': 'error'});
            /*]]&gt;*/
        </script>
    </div>	

</div>

